{include file="public/layout" /}
<body class="bodystyle" style="overflow-y: scroll;min-width:auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-10">
    {include file="search/bar" /}
    <form class="form-horizontal" id="post_form" action="{:url('Search/conf')}" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>搜索模式</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <label class="curpoin"><input type="radio" name="search_model" value="default" {if condition="empty($search.search_model) || 'default' == $search.search_model"} checked="checked" {/if} onclick="searchModel(this);" />标题分词</label>&nbsp;&nbsp;
                    <br/>
                    <label class="curpoin"><input type="radio" name="search_model" value="accurate" {if condition="!empty($search.search_model) && 'accurate' == $search.search_model"} checked="checked" {/if} onclick="searchModel(this);" />标题完全匹配</label>&nbsp;&nbsp;
                    <br/>
                    <label class="curpoin"><input type="radio" name="search_model" value="intellect" {if condition="!empty($search.search_model) && 'intellect' == $search.search_model"} checked="checked" {/if} onclick="searchModel(this);" />智能模糊（检索标题+seo关键词）</label>&nbsp;&nbsp;
                </dd>
            </dl>
            <dl class="row" id="dl_search_model_default" {if condition="!empty($search.search_model) && 'default' != $search.search_model"} style="display: none;" {/if}>
                <dt class="tit">
                    <label>分词匹配</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <label class="curpoin"><input type="radio" name="title_word_model" value="0" {if condition="empty($search.title_word_model)"} checked="checked" {/if}>任意词汇</label>&nbsp;&nbsp;
                    <label class="curpoin"><input type="radio" name="title_word_model" value="1" {if condition="!empty($search.title_word_model) && '1' == $search.title_word_model"} checked="checked" {/if}>全部词汇</label>&nbsp;&nbsp;
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="search_second">搜索频率</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    每 <input type="text" name="search_second" placeholder="" id="search_second" value="{$search.search_second|default=''}" class="w50"> 秒内最多搜索 <input type="text" name="search_maxnum" placeholder="" id="search_maxnum" value="{$search.search_maxnum|default=''}" class="w50"> 次
                    <span class="err"></span>
                    <p class="notic">同一个用户或者IP，在指定秒内只搜索多少次，超过将锁定</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="search_locking">锁定时长</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <input type="text" name="search_locking" placeholder="" id="search_locking" value="{$search.search_locking|default=''}" class="w50"> 秒
                    <span class="err"></span>
                    <p class="notic">锁定期间不能搜索，超过时长后自动解除</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="search_tabu_words">搜索敏感词</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <textarea rows="5" cols="60" id="search_tabu_words" name="search_tabu_words" style="height:150px; width: 250px;" placeholder="一行=1个敏感词
&lt;
&gt;
&quot;
;
,
@
&amp;
#
\
*">{$search.search_tabu_words|default=''}</textarea>
                    <span class="err"></span>
                    <p class="notic">禁止前台用户搜索含有敏感词，防止SQL注入</p>
                </dd>
            </dl>
            <div class="bot">
                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script>

    function searchModel(obj)
    {
        $('#dl_search_model_default').hide();
        if ($('input[name=search_model]:checked').val() == 'default') {
            $('#dl_search_model_default').show();
        }
    }

    function checkForm() {
        layer_loading('正在处理');
        $.ajax({
            type : 'post',
            url : "{:url('Search/conf')}",
            data : $('#post_form').serialize(),
            dataType : 'json',
            success : function(res){
                layer.closeAll();
                if(res.code == 1){
                    layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                        window.location.reload();
                    });
                }else{
                    showErrorMsg(res.msg);
                }
            },
            error: function(e){
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    }
</script>
{include file="public/footer" /}
